package com.starsola.cloud.orderserver.service.impl;

import com.starsola.cloud.orderserver.domain.Order;
import com.starsola.cloud.orderserver.service.IOrderService;
import com.starsola.cloud.productapi.entity.Product;

import java.util.Date;
import java.util.UUID;

public class OrderServiceImpl implements IOrderService {

    @Override
    public Order save(Long userId, Long productId) {
        Product product = null;


        Order order = new Order();
        order.setCrateTime(new Date());
        order.setOrderNo(userId + "_" + UUID.randomUUID().toString().replace("-", ""));
        order.setProductName(product.getName());
        order.setProductPrice(product.getPrice());
        order.setUserId(userId);

        return order;
    }
}
